import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Scanner;

public class LineCount {
	static long chars = 0;
	static int fileCount = 0, lineCount = 0;
	public static void main(String[] args) throws IOException,
			FileNotFoundException {
		new FileTraversal() {
			@Override
			public void onFile(final File f) {
				if (f.getName().endsWith("java")) {
					// TODO
					fileCount++;
					try {
						Scanner in = new Scanner(f);
						while (in.hasNextLine()) {
							chars += in.nextLine().length();
							lineCount++;
						}
					} catch (IOException ex) {
					}
				}
			}
		}.traverse(new File("src"));
		System.out.println(String.format("%d plików, %d linijek, %d znaków",
				fileCount, lineCount, chars));
	}
}